package info.gridworld.actor;

import info.gridworld.grid.Location;

import java.util.ArrayList;

public class ChameleonKid extends ChameleonCritter {

	protected Location getFrontLocation(){
		return getLocation().getAdjacentLocation(getDirection());
	}
	
	protected Location getBehindLocation() {
		return getLocation().getAdjacentLocation(getDirection() + Location.HALF_CIRCLE);
	}


	@Override
	public ArrayList<Actor> getActors() {
		
		ArrayList<Actor> neighbors = getGrid().getNeighbors(getLocation());
		ArrayList<Actor> actors = new ArrayList<Actor>();
		
		for(Actor a : neighbors) {
			if(a.getLocation().equals(getBehindLocation())
					||a.getLocation().equals(getFrontLocation()))
				actors.add(a);
		}
		
		return actors;
	}
	
	

}
